import Vue from 'vue';
import Vuex from 'vuex'
Vue.use(Vuex)  

const actions = {
    increment(minstore,value){
        minstore.commit('PLUS',value)
    },
    decrement(minstore,value){
        minstore.commit('JIAN',value)
    },
}
const mutations = {
    PLUS(state,value){
        state.sum += value
    },
    JIAN(state,value){
        state.sum -= value
    },
}
const state = {
    sum : 0
}
// 创建并暴露一个store 并管理 actions mutations state
export default new Vuex.Store({
    actions,
    mutations,
    state
})